
@rendermode InteractiveServer
<Table TItem="资金流水表"
       Items="@_accountDetails"
       IsPagination="true"  
       IsStriped="true" IsBordered="true"
       ShowAddButton="false"
       ShowEditButton="false"
       ShowExtendEditButton="false"
        ShowExtendDeleteButton="false"
       ShowDeleteButton="false"
       ShowToolbar="false"  
        ShowExtendButtons="true" >
    <TableColumns>

            <TableColumn @bind-Field="@context.流水ID" Width="100"></TableColumn>
            <TableColumn @bind-Field="@context.用户ID"  ></TableColumn>
            <TableColumn @bind-Field="@context.创建时间" ></TableColumn>
            <TableColumn @bind-Field="@context.变动金额" ></TableColumn>   
            <TableColumn @bind-Field="@context.操作人ID" ></TableColumn>   
            <TableColumn @bind-Field="@context.关联业务ID" ></TableColumn>   
            <TableColumn @bind-Field="@context.备注" ></TableColumn>   
    </TableColumns>
            <RowButtonTemplate>
            <TableCellButton Color="Color.Primary" Icon="fa-solid fa-pen" Text="业务详情" OnClick="@(() => OnRowButtonClick(context))" />
            </RowButtonTemplate>
</Table>

@code{
 [Inject]
[NotNull]
private ToastService? ToastService { get; set; }
[Parameter]
[Required] 
 
public List<资金流水表> _accountDetails { get; set; }
  [Inject]
    [NotNull]
    private DialogService? DialogService { get; set; }

private async Task OnRowButtonClick(资金流水表 item)
{
    try
    { 

       if(item.关联业务ID == null)
        {
            await ToastService.Error("加载失败", "关联业务ID为空");
            return;
        }
         
        var option = new DialogOption()
        {
            Title = $"当前流水业务详情 - 业务ID: {item.关联业务ID}",
            Size = Size.ExtraLarge, // 建议调整对话框尺寸
            Component = BootstrapDynamicComponent.CreateComponent<TicketlistDetail>( new Dictionary<string, object?>
                {
                [nameof(TicketlistDetail.TicketID)] = item.关联业务ID 
                })
        };

        await DialogService.Show(option);
    }
    catch (Exception ex)
    {
        // 处理异常，例如显示错误提示
        await ToastService.Error("加载失败", ex.Message);
    }
}

 
}
 